Skip to content

标签与主题 API ​

源码:internal/handlers/song_tag.go、theme_pack.go、theme_pack_catalog.go、internal/app/routers.go;字段定义见 docs/swagger.json。所有接口均要求 Bearer Token。

标签通过 song_tag_links 与歌曲关联,不替代原有 genre / style 字段。主题包为声明式 JSON,目录安装与手动导入共用校验流程;当前激活主题由独立端点管理。

GET /api/v1/song-tags ​

列出所有标签。

参数位置类型必填
keywordquerystringfalse
sortquerystringfalse
orderquerystringfalse
limitqueryintegerfalse
offsetqueryintegerfalse
状态响应类型
200object
500object

POST /api/v1/song-tags ​

创建标签。

参数位置类型必填
requestbodyobjecttrue
状态响应类型
201SongTag
400object
500object

GET /api/v1/song-tags/{id} ​

获取标签详情。

参数位置类型必填
idpathintegertrue
状态响应类型
200SongTag
404object

PUT /api/v1/song-tags/{id} ​

更新标签。

参数位置类型必填
idpathintegertrue
requestbodyobjecttrue
状态响应类型
204object
400object
404object

DELETE /api/v1/song-tags/{id} ​

删除标签。

参数位置类型必填
idpathintegertrue
状态响应类型
204object
400object

POST /api/v1/song-tags/{id}/bind ​

批量绑定歌曲到标签。

参数位置类型必填
idpathintegertrue
requestbodyobjecttrue
状态响应类型
200object
400object
500object

GET /api/v1/song-tags/{id}/song-ids ​

获取标签下所有歌曲 ID。

参数位置类型必填
idpathintegertrue
状态响应类型
200array<integer>
400object
500object

GET /api/v1/song-tags/{id}/songs ​

获取标签下的歌曲列表。

参数位置类型必填
idpathintegertrue
limitqueryintegerfalse
offsetqueryintegerfalse
状态响应类型
200object
400object
500object

POST /api/v1/song-tags/{id}/unbind ​

批量解绑歌曲。

参数位置类型必填
idpathintegertrue
requestbodyobjecttrue
状态响应类型
200object
400object
500object

GET /api/v1/theme-packs ​

列出主题包。

状态响应类型
200array<ThemePackListItem>

POST /api/v1/theme-packs ​

导入主题包。

参数位置类型必填
requestbodyobjecttrue
状态响应类型
200ThemePackResponse
400ErrorResponse

GET /api/v1/theme-packs/active ​

获取激活主题包。

状态响应类型
200ThemePackResponse

PUT /api/v1/theme-packs/active ​

设置激活主题包。

参数位置类型必填
requestbodyobjecttrue
状态响应类型
200SuccessResponse
400ErrorResponse
404ErrorResponse

DELETE /api/v1/theme-packs/active ​

恢复默认主题。

状态响应类型
200SuccessResponse

POST /api/v1/theme-packs/catalog/install ​

从在线目录安装主题包。

参数位置类型必填
requestbodyobjecttrue
状态响应类型
200ThemePackResponse
400ErrorResponse

POST /api/v1/theme-packs/catalog/refresh ​

获取在线主题目录。

参数位置类型必填
requestbodyobjecttrue
状态响应类型
200object

GET /api/v1/theme-packs/{themeID} ​

获取主题包详情。

参数位置类型必填
themeIDpathstringtrue
状态响应类型
200ThemePackResponse
404ErrorResponse

DELETE /api/v1/theme-packs/{themeID} ​

删除主题包。

参数位置类型必填
themeIDpathstringtrue
状态响应类型
200SuccessResponse
404ErrorResponse

歌单共享标签 ​

歌曲与歌单共用 /song-tags 标签定义。歌曲绑定使用 song_tag_links,歌单引用保存在 labels 的 tag:<id> 中。GET/PUT /api/v1/playlists/{id}/tags 返回共享定义或以必填 {"tag_ids":[1,2]} 替换引用;空数组清空自定义标签并保留系统标记,无效 ID 导致整次更新失败。

SongTag 分别返回 song_count 与 playlist_count,后者不含隐藏歌单。/song-tags?sort=playlist_count 可按可见歌单数排序。删除定义在同一事务内清理歌曲与歌单引用。